from Crypto.Cipher import DES
import binascii
import requests


def func(a,b,c):
    if b == 0:
        return a[c:]
    d = '' + a[:b]
    d += a[b+c:]
    return d


def shell(data):
    if not data or len(data) <= 16:
        return data
    a = int(data[-1], 16) + 9
    b = int(data[a], 16)
    data = func(data, a, 1)
    a = data[b:b+8]
    data = func(data, b, 8)
    b = a.encode('utf-8')
    a = a.encode('utf-8')
    data = des_decrypt(data, b)
    json_data = data[:data.rindex('}') + 1]
    return json_data


def des_decrypt(data, b):
    data = binascii.a2b_hex(data)
    des = DES.new(key=b, mode=DES.MODE_ECB)
    data = des.decrypt(data).decode()
    return data


if __name__ == '__main__':
    # shell('C29613DF080BE65F2F4CC96D1739857C0397683785EB3E9D7EA1B3745841BEB4B916DE103D73ACFB4E74A7FB60E3FDE24C35583DD27E8C022D9CBF97708FAA1EEDF3347F1696833180D4CDEB54087FF6F5B23A167B678D69C86B48C0527EAB5492262ED0A9BCF292E0D8E9CB7467000EE587214EE3B13BA3435CC9C1AAECF8351B81D486EC8D51F1285643CAB3CCF36D5763833E83559516CF7733A166C8BA12A3CA2C5F69544BF0E423181550B71F2053F04399F2C301C1268936E3FF7C6252AD1852A3B05ECE35376D4EB40B5FE9EECBCB11354052CBCE903945E30B51E8D46C69550C19DBBEB66517F5EA54F3E4DE3C8B05185A61A09063A8932AC5A6CC6C8C024DF10276E95F3D5217866C51B47159126654FFB8C4271B70367BBD641E4D2A35E195481FD525E7DBA43D0AE5016A75EC07DEA9C07E268EB3711B8FB2FEF344C3CFD6308920DBC9D828E23A95096571C0ADF8ADAE3589C0C68EA1108A7294DB5FAC00E2B32895F08D22F0C8F766C2316B63C9C62EB9664DD41AA307BDD723BD09CE8E636F98CAE5FDE7F7AD381EA87894FB30C6E1337081364BE8A040249D4C922504E5D1D5D539DCC60416927DC05697A2884A544D76D5BBBE1D2CE29E530CC23F3D17C2E5AD123045827D35EC91CCA550759C4FE52924B9ECA664707398D63CD0ABB767F82B6E77462B50D7D328548C613CD4BF92F5CEBCF24CB21FCCD8C3B1EAB6FD224DDB221A5C9990F884ED484D99EDB4D3F3CBA2D0A4F933AE178940F86CE832488C1334066C3A7087093D344F29D8BAAF2474D18309866BE5E77BBB5982E27D12961885D344E43A118AE0A807B7DBA14ED98D8007D899F003D9D7784DA92D92727AF149D68939255A90616B3BFB8A96E22FE9F1945088F4B5AB23D976BFF2E3FE1BA8F8857C75F5413B7D360446B89C85F1A58EA9DE50DE5BD20830403410AB05E213DF5A62A872C031FED1A6BB6ADE7DE2742381995C3212C916AB66F770BF46C9EEA92DB06810164DF1AE24B47794AE2EE27E981B80A72D1502BB1E697E4C415591183FC81F92AAF02C57F70BD8C30C5D5C1CD35A9421DD467CCC67BA8AE3578F72D071EB3AEA5064EFD1AF4E6840C7A9479026685FF168202485FA03BE5D8BAD26706808605742D0BD3AE5163D82A0AAD1E8DE1AA2B3961A186F0A2183CDFD3CB5A3C1884231B5F289520FAC10B9DE8300CFA3F10C67D9647236B800971BE316EEF3F811339C5F1B9FD1AB470D79956BFB95FCAF6228AE094B586BCC60AF19B51A174DB7C224EA0DCFF62AE2F36784421C433DA78791527091F27F3C9F926ACE02FE63B07B4BC44E8CCC8FD95F9368A172DBDA1B806B95CFE16BDC0DD2E2474B8158B5D752920773485F978DE2D9225AA567BBA5D0F7AF2D9346CA8F42B0F32F372C5E85F76F3FC62956E335D62F894AE907D53B8FA0B5A75254EA8369CA9B00D819DF5728A9B454C12256B59C13369F525BD8F92C493BF4913663BB8C420C64CA1E7AD6EB1C8D2FF3E2CDE778A103B29C6AAB2638582A2825AE7ABE90E933DF0F539CAD620B5B637B4C90C873D56BD5521B0C7385BD43754A75AD99B61A804255EC894EFFAB678D69C86B48C05EF0F335DA56F3511EE7D5D58E3A702EC467000EE587214EE438B72F6174AFB11AECF8351B81D486E1B287E5EBD0DAE793CCF36D5763833E83AEEAFD9F52DE6966C8BA12A3CA2C5F698F4586706A3FE2B0B71F2053F04399F2C301C1268936E3FFE44A7CA78B07A0BF239235131254702B5FE9EECBCB11354052CBCE903945E30B51E8D46C69550C19DBBEB66517F5EA54F3E4DE3C8B05185A61A09063A8932AC71BA65689D28B793C7CF0DFDD6B62D055E8C2FDB1040D4A86AFB7DE6C2EE824D5CAB84E52426ECE081FD525E7DBA43D0AE5016A75EC07DEA55B22EFFBA932BB5FB2FEF344C3CFD63BD68AD2C2709314E506FC82A9942AA2CBE316EEF3F811339C5F1B9FD1AB470D7B0A75134AEF584978AE094B586BCC60A2EE832DB0F140A0E06F850E109DF4A48DFAE169098229C027A107E394AB7925D8B3242C8226DA11493B5FABF28C10EC8E547222BFF98DE7D8FEC4405762A8C736927DC05697A2884A544D76D5BBBE1D2CE29E530CC23F3D105434400501C33EDD35EC91CCA550759C4FE52924B9ECA664707398D63CD0ABB767F82B6E77462B50D7D328548C613CD4BF92F5CEBCF24CBB0FCBC6F353C0E0A7856BD96AE7BBF2B179E8ED4A03653E2E37E0D7C5563BF3369B6ADF58581D2496A5EFE82C91C6144087093D344F29D8B51149E1B49FBC5310779DCAD06C15BC9D12961885D344E43E547222BFF98DE7DCD6955D91A0ECDBDB678D69C86B48C0527EAB5492262ED0A9BCF292E0D8E9CB7467000EE587214EED771598966106C33AECF8351B81D486E4FE5EE2E9F3607983CCF36D5763833E8E84F312579422C306C8BA12A3CA2C5F69544BF0E423181550B71F2053F04399F2C301C1268936E3FCA59800050958067097F0B3DEE9ADD97B5FE9EECBCB11354052CBCE903945E30B51E8D46C69550C19DBBEB66517F5EA54F3E4DE3C8B05185A61A09063A8932AC6BA460E0F3C3053C9FF4003E466091A253C73A7FD4E81CA562303CEF90475E2FD562EFB7C7C6A55281FD525E7DBA43D0AE5016A75EC07DEAFA0D92225C9FA9C7FB2FEF344C3CFD6344F4FF64C337B3F1B486A0FEDCB4B37F8BA29593CEE7D1B46984CFA27083182BC5F635ABC3FFBC8D9ECF97FEA8C5F2B46684D52378EA66879E9B65CA2DEE74FCC61A5C562579289C11FC1EF74E327420409BE3F82B0707A268237D84FBD745AE43E65B780342154A1938CCD76F2897F362E4AE98F15773EBD6158D9A5C14DA9AFEF10C18D7E15E26EBD0014C37A4CFB2F43E8D3590923970815E2A54154C78F3E9BB6C1CAC3C00F3E63387D5551E462188668BF7E085647F610EB68341A9093B35AEED46F0C3C0FC50673870CE499BCE6160BEC1D9239D6C64160D59F3BC54944FD99D8743E64BCE6B0A4484FB4D8E431B6702E84949786C5C326A2EC7F41482057F25E22CDB234CA960B7632FA2D16DB57CF0DD36E77CEEA643F000CD62F1775C75E05F33785F27C5F1B9FD1AB470D79956BFB95FCAF6228AE094B586BCC60A1E38F37A953BC6550093601D99DDAD31DFAE169098229C02CFA5F1564E7E01D442E21D042DAC09C0BC44E8CCC8FD95F9368A172DBDA1B806B95CFE16BDC0DD2E2474B8158B5D75299828DE67A5C25C04E84F5083B44DA70E7AF2D9346CA8F42B0F32F372C5E85F76F3FC62956E335D62F894AE907D53B8FA0B5A75254EA8369C817069DAB11971B160AC84FFB50C70FBA8695FEF3AEF284FA6EBA9AFB78F027B8E0598FB1FDBFD828EF9C982ACB5CB55103B29C6AAB2638582A2825AE7ABE90EDEC60C7B5439B3D0B5B637B4C90C873DE5E9C627079B13BAFBAEEE4A3AEF2E7439AC0C08337C05B82727AF149D689392EA8B48F09B9ADBBD6E22FE9F1945088F66751DA1FEBC8BA9F2BE53DA241BBB9C5413B7D360446B894F3078B8804F4E55A7E342EE00A9FB37C34C055CD98CBF162C031FED1A6BB6ADE7DE2742381995C3212C916AB66F770BF46C9EEA92DB06813B164492115F93964AE2EE27E981B80A72D1502BB1E697E4C415591183FC81F92AAF02C57F70BD8C30C5D5C1CD35A9421DD467CCC67BA8AE749AE662354843BE4603236B3D71B573CF541927D4AD9CA1E39404DF22A412CC10D2CFE8E300F58F742D0BD3AE5163D82A0AAD1E8DE1AA2BE3189FFB9F374ABB35AF95638BB8584A5BB4A91C629DFACA0C0E315B8950A135339284BF150E9B2BB678D69C86B48C0574A8383F5C4D06E5513573B51D825F94467000EE587214EE7B2E05CCC3E6AD29AECF8351B81D486EDB92A06E0E4506E73CCF36D5763833E83F0AA97887081DDA6C8BA12A3CA2C5F69544BF0E423181550B71F2053F04399F2C301C1268936E3F60DFD097230C074D963803142870F106B5FE9EECBCB11354052CBCE903945E30B51E8D46C69550C19DBBEB66517F5EA54F3E4DE3C8B05185A61A09063A8932AC53FD8241F2C95A21F9769A3F2DD71032CE168A25F8E951FD6E68D6DADEA0DD922EF97C89AFD0B65481FD525E7DBA43D0B3455749E21455AFAE46EFB782ACAAE3FB2FEF344C3CFD630D588593E4D0F586B67B0F0582684E1B04D0732F0E26991912E84802AF38AF6470029CC6874C2C828DA6B29A15A46BB4D76F61BD8A5E2ACCAECF8351B81D486E513B1815168A770C3CCF36D5763833E81E49A6136594F2835D1D5D539DCC60416927DC05697A2884A544D76D5BBBE1D2CE29E530CC23F3D1B57DE666185620DDD35EC91CCA550759C4FE52924B9ECA664707398D63CD0ABB767F82B6E77462B50D7D328548C613CD4BF92F5CEBCF24CB21FCCD8C3B1EAB6FA96D49D3F7BD70157178E8E8620EC53E262469F8723AE6FBCE2CEABE5307414C36D4EC64246A8793087093D344F29D8BAAF2474D18309866B5C0E699E24B1A92D12961885D344E43E1F153CAC52D03DB1335169A7F6627F6B678D69C86B48C0527EAB5492262ED0A9BCF292E0D8E9CB7467000EE587214EE2E94313C7D0C5A4B36F98CAE5FDE7F7A956BEC642FB9FEA56E1337081364BE8A29459F791906D463BB64E342ECD8296FFCC31EEADA39A885AA40645BB81B2BA51E7F4D0ACC57232846BDECA8C398272FD8923DD68E469C37E1032F72D2B8AD09D3EA5235534DE7E10E82B75BD0C376999B05B9CDEF96A2A2311ED687ED24A7D636CE5D3DC50772CB702CDB7D2B4C7F6BC93038D1E94A881D698747862CBBBEF3997AB38D4DEF92CC1E526F79FA2A7AB6DD68354C3486E8757414AA4C266A35624C281DAED7650F303BCC8020E1DDCBF0C3FC3DB049B7E0636984CFA27083182BC5F635ABC3FFBC8DDA4CF462902B12306684D52378EA668742558F11B438B3AC53194039CC5A7F4A586BEF8276760A81D340842146F2408B3620E7CDEF6F274543E65B780342154AC0C0F0583F153B7862E4AE98F15773EBD6158D9A5C14DA9ABBA8DBEBB5414B1F89EC2CE85624E5E7F43E8D3590923970815E2A54154C78F3E9BB6C1CAC3C00F3E63387D5551E462188668BF7E085647F35265CB1E02679EF40ABEE9C5F898BD558DEF7E66957A500B1B011CB707E19971FBEE2DA9AFB681C2A5040480CAC7CBD6B0A4484FB4D8E431B6702E84949786CEBA0A16712032BFB057F25E22CDB234C2CD6C822ED87EEF1F5B32DF322AF6C1F6984CFA27083182BC5F635ABC3FFBC8D1CD08DAE6D905BD96684D52378EA668726117C567EF2D307D82F64E36ECAC2AF676E50290EA06345D340842146F2408B48CC4238FD9DCDAD43E65B780342154AC0C0F0583F153B7862E4AE98F15773EBD6158D9A5C14DA9AC0B066128932F6FF664EAFDC300B0427F43E8D3590923970815E2A54154C78F3E9BB6C1CAC3C00F3E63387D5551E462188668BF7E085647F610EB68341A9093B5F4221426662A82F7AF040D3353696C22DFE30D7A95687B54E0BC72D2744C4AA70C2D2988C5D6DC66B0A4484FB4D8E431B6702E84949786C63D1CA3926395FCA057F25E22CDB234C3EF331A8CDED286869661A70C1C93A696984CFA27083182BC5F635ABC3FFBC8DDA4CF462902B12306684D52378EA6687B5363C9C62CF21910E1AFF7548F91ADAF74FE5C5A5C738F1D340842146F2408B7A46851AF1102BF943E65B780342154AC0C0F0583F153B7862E4AE98F15773EBD6158D9A5C14DA9A229BFF2621FDC94E2B5A262044E7ECC6F43E8D3590923970815E2A54154C78F3E9BB6C1CAC3C00F3E63387D5551E462188668BF7E085647F610EB68341A9093B567D2D46217C03626F8BAAB01E1999ADD9A4B82CC7855E8CC5530B0E9A206467E23BBB7DB782EDD46B0A4484FB4D8E431B6702E84949786C90C167824AACC1C6057F25E22CDB234C76EFF2E94811CE4D173FCEF13AA81D65E287344CE0B82879C5F1B9FD1AB470D7B0A75134AEF584978AE094B586BCC60A3BE6469B40646FAB2C3D2DE19EF2FBD1967666D2CC35047F409BE3F82B0707A2C6F1BAC64200C38943E65B780342154AC0C0F0583F153B7862E4AE98F15773EBD6158D9A5C14DA9A110730807553FF730967701D9B34C296F43E8D3590923970815E2A54154C78F3E9BB6C1CAC3C00F3E63387D5551E462188668BF7E085647F610EB68341A9093B30673056CB3962FC305BE7217B237ADAB8494D0B1E6B1A13B5ACB259CCEED8265C9A2889CE0A6EAB6B0A4484FB4D8E431B6702E84949786CC43EAE8F63F7C1A8057F25E22CDB234CEDE8E0754E1B46364D7F39EE5F88299A3B9BB88EB0EF59FCAD2C260FB37CA17FD29D515F57E57B903EB0317AF4ECB4006C338503F0ADC4EA216852D2362E70F25413B7D360446B8960AF9AEB1411B4C2CEBF87C433A26B45BC44E8CCC8FD95F9368A172DBDA1B806B95CFE16BDC0DD2E2474B8158B5D75299828DE67A5C25C04E84F5083B44DA70E7AF2D9346CA8F42B0F32F372C5E85F76F3FC62956E335D62F894AE907D53B8FA0B5A75254EA8369C817069DAB11971B160AC84FFB50C70FBE8BBB8E818FEB9DEB812CC99A46D5D22DD6A34A094AE9F07409C15C9D32A8CC5103B29C6AAB2638582A2825AE7ABE90E23E51F0EBC027E0BB5B637B4C90C873D1E4B5781C3E9B886406BEEDF76C34EB8E9331253BDC89BE12727AF149D6893929B588D7E4BF403706E22FE9F1945088F3FB8536D1E154F6A290C91C506F199AADFAE169098229C027A107E394AB7925D2C73229DA979A26493B5FABF28C10EC8A70C6E4BB4CB62AAE5130C0C4FD984C0CBF49CAEF35A5193EC967900C9F81B41F46A12A397811B955AF619C6E3060489CBD3785486E79BDE6AA7D51A6DC2AF110E4FD4F43A647A0FD4448F6ED4D71DF79D2D6239F8BE2AB1403C0A04368236C9AF02B674A1B1D69804C19BED683998246BE0C9976E088E634A638C3EB2E88CE1A25C23A3DE62013A0E3FDE24C35583DD0315D2667FA5123A08FAA1EEDF3347F11894DE654A7E6A3D2116AED2D642ADF177D2C5621F4D31E5BF7B92106CA21E78AD2C260FB37CA17F6A5E2F41B96CBC1388A5BEDA4C2550338274DB1E07781DEB774EE973DF18B1C55413B7D360446B894F3078B8804F4E55F45D5DE5E5BBF06FBC44E8CCC8FD95F9368A172DBDA1B806B95CFE16BDC0DD2E2474B8158B5D752920773485F978DE2D4328580B87CC2FD67AF2D9346CA8F42B0F32F372C5E85F76F3FC62956E335D62F894AE907D53B8FA0B5A75254EA8369CA9B00D819DF5728ABFC00FAAE4CB02D3B0F6FD212896FAED9D95FE6424497F2A3383188AFD3EEED0BF967A0B3268C213103B29C6AAB2638582A2825AE7ABE90EA00E7C05D8DCE1A2B5B637B4C90C873DDE435969C28262317D1F446DE614354559655441B23D8BE5FC9E81559FB28B6508A7294DB5FAC00E46A14E0093CEF555F89B83CAA1F3D7B562EB9664DD41AA304590532758891D08BDF788A11F338F82287F193EC5434B7C0A956CF3A54D9471948D20CDF9560570BB64E342ECD8296FFCC31EEADA39A885AA40645BB81B2BA51E7F4D0ACC572328DFCFE9A743737727D8923DD68E469C37E1032F72D2B8AD09D3EA5235534DE7E10E82B75BD0C376999B05B9CDEF96A2A2311ED687ED24A7D671992C7156DD200EB8B4AB5DF913700D15C38AF66C84E96102D52B94E23384CF9EF1C8290AA8379ACA212E75E38E44C7DD68354C3486E875DBDCB0F867E7D03C5282E2AC6C52AEA43BCC8020E1DDCBF0DBB7B6833A44DFA408A7294DB5FAC00E1F7B89AF9657582210BDEF579721702B62EB9664DD41AA30757250553DF23D6ABDF788A11F338F824C8C53B1B66134030A956CF3A54D947118E8E77764FAEFF0E6FEC96312CE23DA866729F010D92941BBD1CDAA00497910C03CB3588286A98193D8A53DE6A5FA014DA88DE92FF156145D03E1FD1CAE871CB40CD8D353FC5556627A4594AF3C7DEE5225876D1BB1B84151434E42C30023FD215DDD29959130399972D3C589484B443C37B7E206C9EBBE9BEDB9505767CB1F9A5F7B4BEA6DFE70FF9BBB66ECB768FA7364283C057F433D4B0FFB3A00E324E0C530275825C27A327D7D5BBA939EB05780E62C12A2BD569EF458E0C1E0A28A61BC20B4A7C641362D6984CFA27083182BC5F635ABC3FFBC8D8A3A5CFF7894C3F26684D52378EA6687E0F461C2DA83CB8A0E1AFF7548F91ADAB5F3D8189EA37404D340842146F2408B9A3150018415C8EA43E65B780342154AC0C0F0583F153B7862E4AE98F15773EBD6158D9A5C14DA9A229BFF2621FDC94E2B5A262044E7ECC6F43E8D3590923970815E2A54154C78F3E9BB6C1CAC3C00F3E63387D5551E462188668BF7E085647F35265CB1E02679EF5D0158620A71270CC111BC5D309B442A8CBA80B81EE4B9B3F3B71115AC6F2A078BE31B038D0DD3FC6B0A4484FB4D8E431B6702E84949786CB3FAE826C4B8362B057F25E22CDB234C1FE2D06206978FB3F34AF62A3D5C56EC2727AF149D689392EA8B48F09B9ADBBD6E22FE9F1945088FFB2F2513300B53EED9BB3F0CE80C14D2DFAE169098229C026960C6471BFAF9FA8B3242C8226DA11493B5FABF28C10EC8E547222BFF98DE7DE5130C0C4FD984C0CBF49CAEF35A5193C75B96C0733961D813F23740E54D47FF5AF619C6E3060489CBD3785486E79BDE6AA7D51A6DC2AF110E4FD4F43A647A0FD4448F6ED4D71DF79D2D6239F8BE2AB11FA4618E1340256BD7C552BBBE6E776E59A18614C99C2F08476CADC993A27AAA7F6142A15B624655A25C23A3DE62013A0E3FDE24C35583DDBFBBF1F4493D098608FAA1EEDF3347F1CF6589BB2AEB10A356D3A6C48373F9E9EB2F76C68707A160CBE20409F6A9BA3284DD6313744A61034BFC798A91539677DF73A0190FCC39467B3CCBA848F7AAAD3178253800C9CF58594EB161176CC144A6403B5C61B4C748880A6633C69465422C031FED1A6BB6ADE7DE2742381995C3212C916AB66F770BF46C9EEA92DB0681AC77ACCA0DB230C44AE2EE27E981B80A72D1502BB1E697E4C415591183FC81F92AAF02C57F70BD8C30C5D5C1CD35A9426A71165116AE792E2601D3A323A51D496072F8031AB645A742DC18FB6419004B332E207A7AE9DAFE25D3CC33F7F37649874BF71AC01934908E2B8D34AE48391C9E80807F68E72E28BD7544C10A309BAC')
    url = 'https://www.endata.com.cn/API/GetData.ashx'
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36',
    }
    data = {
        'year': '2022',
        'MethodName': 'BoxOffice_GetYearInfoData',
    }
    res = requests.post(url, headers=headers, data=data)
    data = shell(res.text)
    print(data)




